﻿using MediatR;
using SheepStorage.API.Application.Command.BodySizeCommand;
using SheepStorage.API.Application.Command.SheepConditionCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepConditionHandler
{
    public class SheepConditionDelHandler : IRequestHandler<SheepConditionDelCommand, Results<int>>
    {
        private readonly ISheepConditionService service;

        public SheepConditionDelHandler(ISheepConditionService service)
        {
            this.service = service;
        }

        public async Task<Results<int>> Handle(SheepConditionDelCommand request, CancellationToken cancellationToken)
        {
            var list = service.DelSheepCondition(request.SheepConditionId);
            return Results<int>.DataResult(list);
        }
    }
}
